<?php

class Html_AdminController extends Veneer_Controller_Admin
{

	function init()
	{
		$this->_dbArray =array('Html');
		$this->_moduleName = 'html';
		$this->_module_id = 6;
		$this->_primary_table ='Html';

		Zend_Layout::getLayout('index')
	        ->addRequest(new Zend_Layout_Request('moduleMenuZone',
			'addAdminMenuLink', 'block','default',
			array( "moduleName"=>$this->_moduleName,"actionName"=>"new","promptName"=>"New Page")));
		parent::init();
	}

    function indexAction()
    {
        $table = new Html();
        $this->view->objects = $table->fetchPage();
        $this->view->title = "HTML Pages";
    }


    function viewAction()	// view that can also show inactive pages
    {
        $table = new Html();
        $this->view->obj = $table->fetchUtlToken($this->_veneer_parms['p1']);
//		if($this->view->obj == null) redirect to page not found

    }

    function newAction()
    {
		Zend_Layout::getLayout('index')
	        ->addRequest(new Zend_Layout_Request('jsZone',
			'yuiRichTextJs', 'block','default'));
		$form = new Zend_Form();
		$form->setDataSource($_POST);
		$form->addField('html_title');
		$form->addField('url_title');
		$form->addField('html');
		if($this->getRequest()->isPost()) {

			if ($this->getRequest()->isPost()) {
			    if ($form->isValid()) {
        			$data = $form->getData();
// Insert()
				//redirect
 				}
			}
		}
		$this->view->form = $form;
    }
	function editAction()
	{

	}


}